﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace SubstrateHelper.Models
{
    public class ParameterBase:SequenceBase
    {
        
        [Display(Name = "Id")]
        [Required(ErrorMessage = "不能为空！")]
        public int ID { get; set; }
        

        [Display(Name = "参数显示名")]
        [Required(ErrorMessage = "参数显示名不能为空！")]
        [StringLength(20, ErrorMessage = "最大长度=20！")]
        public string Name { get; set; }


        [Display(Name = "值类型")]
        [Required(ErrorMessage = "不能为空！")]
        public ValueType ValueType { get; set; }


        /// <summary>
        /*
            bit0=追溯性
            bit1=首检
            bit2=自检
            bit3=互检
            bit4=巡检
            bit5=专检
            bit6=末检
        */
        [Display(Name = "参数类型")]
        [Required(ErrorMessage = "不能为空！")]
        public UInt32 InspectionType { get; set; }


        


        

        [Display(Name = "初始状态")]
        [Required(ErrorMessage = "不能为空！")]
        public bool InitDiscarded { get; set; }



        [Display(Name = "输入辅助类别")]        
        public string InputSuggestingCategory { get; set; }

        [Display(Name = "输入辅助类型")]
        public InputSuggestingType InputSuggestingType { get; set; }



        [Display(Name = "参数单位")]
        [StringLength(20, ErrorMessage = "最大长度=20！")]
        public string Unit { get; set; }



        /*
            bit0=操作员
            bit1=质检员
            bit2=技术员
            bit3=调度员
            bit4=设备人员
            bit5=销售人员
            bit6=管理人员     
         */
        [Display(Name = "写掩码")]
        [Required(ErrorMessage = "不能为空！")]
        public UInt32 WriteMask { get; set; }


        /*
            bit0=操作员
            bit1=质检员
            bit2=技术员
            bit3=调度员
            bit4=设备人员
            bit5=销售人员
            bit6=管理人员     
         */
        [Display(Name = "读掩码")]
        [Required(ErrorMessage = "不能为空！")]
        public UInt32 ReadMask { get; set; }


        /*
            bit0=操作员
            bit1=质检员
            bit2=技术员
            bit3=调度员
            bit4=设备人员
            bit5=销售人员
            bit6=管理人员     
         */
        [Display(Name = "检验掩码")]
        [Required(ErrorMessage = "不能为空！")]
        public UInt32 InspectionMask { get; set; }


        /*
            bit0=操作员
            bit1=质检员
            bit2=技术员
            bit3=调度员
            bit4=设备人员
            bit5=销售人员
            bit6=管理人员     
         */
        [Display(Name = "检验掩码")]
        [Required(ErrorMessage = "不能为空！")]
        public UInt32 RemoveMask { get; set; }

        /// <summary>
        /// 是否废弃此条参数（目的：参数变更时方便修改，同时兼容旧记录）
        /// </summary>
        public bool IsDiscarded { get; set; }
    }

    public enum ValueType
    {
        Text = 0,//文本类，值类似"我的文本123"
        Numeric = 1,//数值类，值类似"123.45"
        DateTime = 2,//时间类，值为"YYYY-MM-DD HH:MM:SS"       
        Date=3
    }

    

    

    

    

    public enum InputSuggestingType
    {
        NoSuggestion=0,
        FromInventoryByEntityName=1,
        FromInventoryByCategory=2,
        FromInputSuggestingTable=3,
        FromUser=4
    }
}
